package base.day21.MyHashSet2;

import base.day21.Student;

import java.nio.channels.NetworkChannel;
import java.util.HashMap;
import java.util.Map;

public class MyMap1 {
    public static void main(String[] args) {
        Map<String,String> map=new HashMap<>();
        map.put("zhangsan","张三");
        map.put("lisi","李四");
        map.put("wangwu","王五");


        //remove根据建删除 建值对应的元素
        map.remove("lisi");
        System.out.println(map);

        //containsKey 判断集合中是否有对应的键
        boolean result = map.containsKey("zhangsan");
        System.out.println(result);

        //containsValue 判断集合中是否有指定的值
        boolean result2=map.containsValue("张三");
        System.out.println(result2);

        //isEmpty 判断集合中是否为空
        boolean result3=map.isEmpty();
        System.out.println(result3);

        //size 集合的长度
        int result5=map.size();
        System.out.println(result5);

        //clear 清清除集合中所有元素
        map.clear();
        System.out.println(map);
    }
}
